//路由配置
(function() {
	var Main = APM.Main = createApp("main");

	Main.routerMap(function() {
		this.route("login");
		this.route("frame");
		this.route("license");
		this.route("user", function() {
			this.route("password");
		});
	});

	APM.MainIndexRoute = Main.Route.extend({
		redirect: function() {
			this.transitionTo("main.login");
		}
	});

	APM.MainLoginRoute = Main.Route.extend({
		templates: [
			"main/login",
			"loginFrame"
		],

		dependences: [
			"./ctrls/login_ctrl"
		],

		renderTemplate: function() {
			this.render("loginFrame", {
				controller: "mainLogin"
			});
			this.render("main/login", {
				into: 'loginFrame'
			});
		}
	});
	APM.MainFrameRoute = Main.Route.extend({
		dependences: [
			"./ctrls/frame_ctrl",
			"./views/frame_view",
		]
	});

	APM.MainLicenseRoute = Main.Route.extend({
		templates: [
			"main/license",
			"loginFrame"
		],
		dependences: [
			"./ctrls/license_ctrl"
		],
		renderTemplate: function() {
			this.render("loginFrame", {
				controller: "mainLicense"
			});
			this.render("main/license", {
				into: 'loginFrame'
			});
		}
	});

	APM.MainUserRoute = Main.Route.extend({
		templates: [{
			name: "main/frame",
			url: "./main_frame.hbs"
		}],

		dependences: [
			"./ctrls/frame_ctrl",
			"./views/frame_view",
		],

		renderTemplate: function() {
			this.render("main/frame", {
				controller: "mainFrame",
				view: "mainFrame"
			});
		}
	});

	//默认跳转到修改密码
	APM.MainUserIndexRoute = Main.Route.extend({
		redirect: function() {
			this.transitionTo("main.user.password");
		}
	});

	APM.MainUserPasswordRoute = Main.Route.extend({
		templates: [
			"main/user/password"
		],
		dependences: [
			"./ctrls/password_ctrl"
		]
	});
})();